package com.audi.adapter;

import java.util.List;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.net.wifi.p2p.WifiP2pDevice;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.audi.R;

public class ListWifiAdapter extends BaseAdapter {

	private Activity mActivity;
	private LayoutInflater inflater = null;
	private List<WifiP2pDevice> mList;

	public ListWifiAdapter(Activity activity, List<WifiP2pDevice> list) {
		mActivity = activity;
		mList = list;
		inflater = (LayoutInflater) mActivity
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}

	public int getCount() {
		return mList.size();
	}

	public Object getItem(int pos) {
		return pos;
	}

	public long getItemId(int pos) {
		return pos;
	}

	@SuppressLint({ "ViewHolder", "InflateParams" })
	public View getView(int pos, View convertView, ViewGroup parent) {
		convertView = inflater.inflate(R.layout.row_wifi, null);
		TextView txt_wifi_name = (TextView) convertView
				.findViewById(R.id.txt_wifi_name);
		txt_wifi_name.setText(mList.get(pos).deviceName);
		return convertView;
	}

}